package com.atguigu.dga.common.util;

import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.apache.http.client.methods.RequestBuilder;

public class HttpUtil {

    public static OkHttpClient client = new OkHttpClient();



    public static String get(String url) throws Exception{

        //建造者模式
        Request request = new Request.Builder().url(url).get().build();

        Call call = client.newCall(request);

        Response response = call.execute();

        String result = response.body().string();

        return result;

    }

    public static void main(String[] args) throws Exception {
        String html = HttpUtil.get("http://dga.gmall.com/tableMetaInfo/table-list?schemaName=&tableName=&dwLevel=&pageSize=20&pageNo=1");
        System.out.println("html = " + html);

    }



}
